package com.bridge.client.bridgedynamcclient.controller;

import com.bridge.client.bridgedynamcclient.custom_compinents.ProgressDialog;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Objects;

public class BaseController {

    protected Stage appStage;

    protected AnchorPane root;

    protected Logger logger= LoggerFactory.getLogger(this.getClass());
    private ProgressDialog progressDialog;
    public void init(Stage appStage){
        this.appStage=appStage;
    }


    public void setRoot(AnchorPane root){
        this.root=root;
        logger.info("BaseController--setRoot："+this.getClass().getSimpleName());
    }


    public void showLoading(){
       showLoading("处理中...");
    }
    public void showLoading(String msg){
        progressDialog=new ProgressDialog(msg);
        progressDialog.show();
    }

    public void dismissLoading(){
        if(null!=progressDialog){
            progressDialog.closeDialog();
            progressDialog=null;
        }
    }

}
